package week1;

public class Ex2 {
    public static void main(String[] args) {
        int  i = 1, t, sum = 0;
        t = 1;
        while(t < 4000000){
            if (t % 2 == 0)
                sum += t;
            t = fab(++i);
        }
        System.out.println(sum);
    }
    public static int fab(int i){
        if (i == 1) return 1;
        if (i == 2) return 2;
        return fab(i - 1) + fab(i - 2);
    }
}
